package com.jd.charactercalculator.util;

import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.util.PropertyFilter;

/**
 * 
 * @Description: 
 * @author :Sun Lin
 * @date :2012-9-17
 * @since:1.0.0 
 */
public class BeanUtils {

	public static String bean2Json(Object object) {
		JsonConfig config = new JsonConfig();
		config.setJsonPropertyFilter(new PropertyFilter() {
			@Override
			public boolean apply(Object source, String name, Object value) {
				return value == null;
			}
		});
		return JSONObject.fromObject(object, config).toString();
	}
}
